package com.inzone.fram.gray.config;

import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
import com.alibaba.nacos.api.NacosFactory;
import com.inzone.fram.gray.common.filter.InitMatchingContextFilter;
import com.inzone.fram.gray.common.rule.MatchingMetadataRule;
import com.netflix.loadbalancer.AbstractLoadBalancerRule;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;
import javax.servlet.http.HttpServletRequest;

/**
 * 自动配置提供灰度算法
 *
 * @author 丁常磊
 * @date 2021/10/15 18:47
 */

@Configuration
@ConditionalOnClass({
        NacosFactory.class,
        NacosDiscoveryProperties.class,
        AbstractLoadBalancerRule.class
})
public class MatchingRuleConfig {

    /**
     * 匹配原数据负载均衡策略
     * 需要依赖nacos注册中心
     * @return
     */
    @Bean
    public MatchingMetadataRule matchingMetadataRule() {
        return new MatchingMetadataRule();
    }

}
